package com.example.demo.userController;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {
    @Value("${server.port}")
    private String port;


    @Value("${myyml1}")
    private String str1;
    @Value("${myyml2}")
    private String str2;
    @Value("${myyml3}")
    private String str3;


    @RequestMapping("/sayHi") //设置路由地址 必须小写
    @ResponseBody  //返回字符串 如果没加就是返回页面数据
    public String sayHi() {
        System.out.println(str1);
        System.out.println(str2);
        System.out.println(str3);//会打印在日志中
        return "hello UserController port:" + port;
    }
}
